<template>
  <div id="shop">  
     
      <div  style="display:flex;align-items: center;">
          <img class="top_img" src="@/assets/images/a8.png" style="width:35px;height:35px;margin-right:10px;"/>
          <div style="line-height: 40px;font-weight:bold:">产品仓库</div>
    </div> 

    <el-form ref="form"  label-width="80px"> 

      <div style="display:flex;align-items: center;">
             
             <div style="width:50px;text-align-last: justify;margin-top:-12px;font-size: 14px;color: #606266;margin-right:10px;">查询项</div>
             

            <el-form-item label="商品查询">
               <el-input v-model="form.pname" placeholder="商品名称"  style="width:140px;"></el-input>
            </el-form-item>

            <div class="buttoon_box">
                <div class="buttoon_box_item"  style="margin-left:10px;background:#FFC600;color:white;" @click="search_but1()">确 定</div>
                <div class="buttoon_box_item" style="margin-left:10px;border:1px solid #D9D9D9;" @click="refresh_but()">清 空</div>    
            </div>

      </div>

            <el-row>           
                <el-col :span="24" style="text-align: right;">
                   <el-button class="custom_color_button1" type="primary"  style="margin-bottom:10px;" @click="go_but()">
                     <img class="custom_color_button1_img" src="@/assets/images/but_bg2.png" />产品上架
                    </el-button>
                </el-col>      
            </el-row>
   </el-form>

   <!-- 渲染数据list -->
   <my-shop-list :datalist="datalist" @up_list_fun="list_fun"> </my-shop-list>
 
    <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>
     
  </div>
</template>

<script>
import MyShopList from '@/view/Shop/ShopList'
export default {
  name: 'ShopList',
  data () {
    return {
        datalist:[{"name":"aaaaa"}],
        page:1,
        count:0,
        form:{
          pname:''
        }
    }
  },
 components:{
    MyShopList
  },
  created(){
     this.list_fun()
  },
  mounted (){
    
  },
  methods: {
      list_fun(){
          this.post("/product/listOfData", {
              page:this.page, 
              pname:this.form.pname, 
	        }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list
            console.log(res)
         })
      },
      search_but1(){
        this.page = 1
        this.list_fun()
      },
      refresh_but(){
        this.page = 1
        this.form.pname = ''
        this.list_fun()
      },
      go_but(){
        this.$router.push({
          path: '/index/shop/warehouse/basics',
          query: {
            // name:this.user_name,
            // id:row.uid
          }
        })
     },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
     

  }
}
</script>


<style scoped>

</style>
